package com.sisgesbyte.dao.sistema;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.apache.log4j.Logger;
import com.sisgesbyte.data.entity.sistema.ValidaEmpresaEntity;
import com.sisgesbyte.data.util.AbstractFacade;


@Stateless
public class SistemaDaoImpl extends AbstractFacade<ValidaEmpresaEntity> implements
		SistemaDao {

	 private static final Logger LOGGER = Logger.getLogger(SistemaDaoImpl.class);
	 
	@PersistenceContext(unitName = "SigesSiscompPU")
	private EntityManager em;

	@Override
	protected EntityManager getEntityManager() {
		return em;
	}

	public SistemaDaoImpl() {
		super(ValidaEmpresaEntity.class);
	}

	@Override
	public ValidaEmpresaEntity validarEmpresa(int codEmpresa) {
			Query query = em.createNamedQuery("sistema.validarEmpresa");
			query.setParameter("codEmpresa",codEmpresa);	
		return (ValidaEmpresaEntity) query.getSingleResult();	
	}

}